/*     */ package com.umeng.newxp.view;
/*     */ 
/*     */ import android.app.AlertDialog;
/*     */ import android.app.AlertDialog.Builder;
/*     */ import android.content.Context;
/*     */ import android.graphics.drawable.Drawable;
/*     */ import android.os.Handler;
/*     */ import android.text.TextUtils;
/*     */ import android.view.View;
/*     */ import android.view.View.OnClickListener;
/*     */ import android.view.ViewGroup;
/*     */ import android.view.WindowManager.BadTokenException;
/*     */ import android.widget.ImageView;
/*     */ import android.widget.ListView;
/*     */ import android.widget.RelativeLayout;
/*     */ import android.widget.TextView;
/*     */ import android.widget.Toast;
/*     */ import com.umeng.common.Log;
/*     */ import com.umeng.common.b;
/*     */ import com.umeng.common.c;
/*     */ import com.umeng.newxp.Promoter;
/*     */ import com.umeng.newxp.a.a;
/*     */ import com.umeng.newxp.common.ExchangeConstants;
/*     */ import com.umeng.newxp.common.g;
/*     */ import com.umeng.newxp.controller.ExchangeDataService;
/*     */ import com.umeng.newxp.controller.XpListenersCenter.AdapterListener;
/*     */ import com.umeng.newxp.controller.XpListenersCenter.EntryOnClickListener;
/*     */ import com.umeng.newxp.controller.XpListenersCenter.ExchangeDataRequestListener;
/*     */ import com.umeng.newxp.controller.XpListenersCenter.FloatDialogListener;
/*     */ import com.umeng.newxp.controller.XpListenersCenter.ReportListener;
/*     */ import com.umeng.newxp.net.XpReportClient;
/*     */ import com.umeng.newxp.net.e.a;
/*     */ import java.util.List;
/*     */ 
/*     */ public class ExchangeViewManager
/*     */ {
/*  52 */   private String f = ExchangeViewManager.class.getName();
/*  53 */   f a = null;
/*  54 */   aF b = null;
/*  55 */   private LargeGalleryConfig g = null;
/*  56 */   private FloatDialogConfig h = null;
/*  57 */   private GridTemplateConfig i = null;
/*     */   Context c;
/*     */   int d;
/*     */   private ExchangeDataService j;
/*     */   XpListenersCenter.EntryOnClickListener e;
/*     */   private ImageView k;
/*     */   private View l;
/*     */   private TextView m;
/*     */   private ImageView n;
/*     */   public List<Promoter> predata;
/*     */ 
/*     */   public ExchangeViewManager(Context paramContext)
/*     */   {
/*  69 */     this(paramContext, new ExchangeDataService());
/*     */   }
/*     */ 
/*     */   public ExchangeViewManager(Context paramContext, ExchangeDataService paramExchangeDataService) {
/*  73 */     this.c = paramContext;
/*  74 */     if (paramExchangeDataService == null)
/*  75 */       this.j = new ExchangeDataService();
/*     */     else {
/*  77 */       this.j = paramExchangeDataService;
/*     */     }
/*  79 */     this.j.layoutType = 7;
/*     */   }
/*     */ 
/*     */   public void addView(ViewGroup paramViewGroup, int paramInt, String[] paramArrayOfString)
/*     */   {
/*  94 */     if (a(paramInt)) {
/*  95 */       return;
/*     */     }
/*  97 */     this.j.layoutType = paramInt;
/*  98 */     this.d = paramInt;
/*     */     try {
/* 100 */       if ((paramArrayOfString != null) && (paramArrayOfString.length > 0) && 
/* 101 */         (paramArrayOfString.length >= 1)) ExchangeConstants.CHANNEL = paramArrayOfString[0];
/*     */ 
/* 104 */       if ((ExchangeConstants.ONLY_CHINESE) && (!b.a(this.c))) {
/* 105 */         Log.b(ExchangeConstants.LOG_TAG, "English os can not show ads");
/* 106 */         return;
/*     */       }
/* 108 */       if (this.d == 7) {
/* 109 */         aw.a(this.c, this.j, null, this.i);
/*     */         return;
/*     */       }
/*     */       Object localObject;
/* 113 */       if (this.d == 11) {
/* 114 */         localObject = new D(this, paramViewGroup);
/*     */ 
/* 142 */         this.j.requestDataAsyn(this.c, (XpListenersCenter.ExchangeDataRequestListener)localObject);
/* 143 */         return;
/*     */       }
/*     */ 
/* 146 */       if (this.d == 12) {
/* 147 */         localObject = g.b(this.c, this.j);
/* 148 */         if (localObject == null) return;
/* 149 */         new i(this.c, (String)localObject).show();
/* 150 */         return;
/*     */       }
/*     */ 
/* 153 */       if (this.d == 8) {
/* 154 */         localObject = new GridTemplate(null, this.j, this.c, this.i);
/* 155 */         paramViewGroup.addView(((GridTemplate)localObject).contentView);
/* 156 */         return;
/*     */       }
/*     */ 
/* 159 */       if (this.d == 15) {
/* 160 */         long l1 = System.currentTimeMillis();
/* 161 */         FloatDialogConfig localFloatDialogConfig = this.h != null ? this.h : 
/* 162 */           new FloatDialogConfig();
/* 163 */         localFloatDialogConfig.setStartTime(l1);
/*     */ 
/* 165 */         if (localFloatDialogConfig.getListener() != null) localFloatDialogConfig.getListener().onStart();
/* 166 */         G localG = new G(this, localFloatDialogConfig);
/*     */ 
/* 187 */         if ((this.j.preloadData != null) && 
/* 188 */           (this.j.preloadData.a == a.a.a)) {
/* 189 */           List localList = this.j.preloadData.b();
/* 190 */           if (localList == null) {
/* 191 */             this.j.requestDataAsyn(this.c, localG);
/*     */           } else {
/* 193 */             if (localFloatDialogConfig.getListener() != null) localFloatDialogConfig.getListener().onPrepared(1);
/*     */ 
/* 195 */             String str = this.j.opensize;
/*     */ 
/* 197 */             if (!TextUtils.isEmpty(str)) {
/* 198 */               if ((localList != null) && (localList.size() > 0) && 
/* 199 */                 (str.equals("0.04"))) {
/* 200 */                 Promoter localPromoter = (Promoter)localList.get(0);
/* 201 */                 a(localPromoter, localFloatDialogConfig.getListener());
/*     */               }
/*     */               else {
/* 204 */                 W.a(this.c, this.j, localFloatDialogConfig, localList);
/*     */               }
/*     */             } else Log.e(this.f, "Unshow the suspended window. opensize is null"); 
/*     */           }
/*     */         }
/*     */         else
/*     */         {
/* 210 */           this.j.requestDataAsyn(this.c, localG);
/*     */         }
/*     */ 
/* 213 */         return;
/*     */       }
/*     */ 
/* 216 */       switch (this.d) {
/*     */       case 6:
/* 218 */         this.a = new f(this.c, paramViewGroup, this.d, this.j);
/*     */ 
/* 221 */         break;
/*     */       case 11:
/* 223 */         this.b = new aF(this.c, paramViewGroup, 
/* 224 */           11, this.j);
/* 225 */         break;
/*     */       case 43:
/* 227 */         LargeGalleryConfig localLargeGalleryConfig = this.g == null ? new LargeGalleryConfig() : this.g;
/* 228 */         new an(this.c, paramViewGroup, this.j, localLargeGalleryConfig);
/* 229 */         break;
/*     */       case 13:
/* 231 */         int i1 = 0;
/* 232 */         new ae(this.c, paramViewGroup, this.d, i1, this.j);
/* 233 */         break;
/*     */       default:
/* 235 */         Log.b(ExchangeConstants.LOG_TAG, String.format(
/* 236 */           "Paramter type  %1$s cannot be handled. It may be deprecated.", new Object[] { Integer.valueOf(this.d) }));
/*     */       }
/*     */     }
/*     */     catch (Exception localException)
/*     */     {
/* 241 */       Log.b(ExchangeConstants.LOG_TAG, "add view error " + localException.getMessage(), localException);
/*     */     }
/*     */   }
/*     */ 
/*     */   private boolean a(int paramInt) {
/* 246 */     if ((paramInt == 7) || (paramInt == 8) || (paramInt == 12)) {
/* 247 */       return false;
/*     */     }
/* 249 */     String str = this.c.getString(com.umeng.newxp.a.e.h(this.c));
/* 250 */     Log.e(ExchangeConstants.LOG_TAG, str);
/* 251 */     Toast.makeText(this.c, str, 0).show();
/* 252 */     return true;
/*     */   }
/*     */ 
/*     */   public void addView(int paramInt, View paramView, Drawable[] paramArrayOfDrawable)
/*     */   {
/* 266 */     if (a(paramInt)) {
/* 267 */       return;
/*     */     }
/* 269 */     this.j.layoutType = paramInt;
/*     */ 
/* 271 */     if (paramView == null) {
/* 272 */       switch (paramInt) {
/*     */       case 7:
/* 274 */         aw.a(this.c, this.j, null, this.i);
/* 275 */         break;
/*     */       case 501:
/* 277 */         localObject = g.b(this.c, this.j);
/* 278 */         if (localObject == null) return;
/* 279 */         new i(this.c, (String)localObject).show();
/*     */       }
/*     */ 
/* 282 */       return;
/*     */     }
/*     */ 
/* 285 */     if ((paramView instanceof ImageView)) { this.k = ((ImageView)paramView);
/* 286 */     } else if ((paramView instanceof RelativeLayout)) {
/* 287 */       localObject = (RelativeLayout)paramView;
/* 288 */       this.k = ((ImageView)((RelativeLayout)localObject).findViewById(c.a(this.c).c("imageview")));
/* 289 */       this.l = ((RelativeLayout)localObject).findViewById(c.a(this.c).c("newtip_area"));
/* 290 */       this.m = ((TextView)((RelativeLayout)localObject).findViewById(c.a(this.c).c("newtip_tv")));
/* 291 */       this.n = ((ImageView)((RelativeLayout)localObject).findViewById(c.a(this.c).c("newtip_iv")));
/*     */     }
/*     */ 
/* 308 */     Object localObject = new H(this);
/*     */ 
/* 342 */     I localI = new I(this);
/*     */ 
/* 368 */     this.d = paramInt;
/* 369 */     switch (paramInt) {
/*     */     case 7:
/* 371 */       if (paramArrayOfDrawable.length == 0) {
/* 372 */         this.k.setVisibility(8);
/* 373 */         g.a(this.k, this.c, this.j, 
/* 374 */           new J(this, localI));
/*     */       }
/*     */       else
/*     */       {
/* 410 */         this.k.setImageDrawable(paramArrayOfDrawable[0]);
/* 411 */         this.j.preloadData(this.c, localI, 
/* 412 */           7);
/* 413 */         this.k.setOnClickListener(new L(this));
/*     */       }
/*     */ 
/* 422 */       break;
/*     */     case 501:
/* 424 */       if (paramArrayOfDrawable.length == 0) {
/* 425 */         g.a(this.k, this.c, this.j, 
/* 426 */           new M(this, (View.OnClickListener)localObject));
/*     */       }
/*     */       else
/*     */       {
/* 443 */         this.k.setImageDrawable(paramArrayOfDrawable[0]);
/* 444 */         this.k.setOnClickListener((View.OnClickListener)localObject);
/*     */       }
/* 446 */       break;
/*     */     }
/*     */   }
/*     */ 
/*     */   public void hideBanner()
/*     */   {
/*     */     try
/*     */     {
/* 455 */       switch (this.d) {
/*     */       case 6:
/* 457 */         if (this.a == null) return;
/* 458 */         com.umeng.newxp.common.a.a(this.a.b);
/* 459 */         break;
/*     */       case 11:
/* 461 */         if (this.b == null) return;
/* 462 */         com.umeng.newxp.common.a.a(this.b.b);
/* 463 */         break;
/*     */       default:
/* 465 */         Log.b(ExchangeConstants.LOG_TAG, "paramter type cannot be handled");
/*     */       }
/*     */     }
/*     */     catch (Exception localException) {
/* 469 */       Log.b(ExchangeConstants.LOG_TAG, "hideBanner error");
/*     */     }
/*     */   }
/*     */ 
/*     */   public void hideBanner(int paramInt) {
/* 474 */     new Handler().postDelayed(new N(this), 
/* 478 */       paramInt * 1000);
/*     */   }
/*     */ 
/*     */   public void setLoopInterval(int paramInt)
/*     */   {
/* 488 */     if (paramInt > 3000) {
/* 489 */       ExchangeConstants.REFRESH_INTERVAL = paramInt;
/* 490 */       ExchangeConstants.IGNORE_SERVER_INTERVAL = true;
/*     */     }
/*     */   }
/*     */ 
/*     */   public void addView(ViewGroup paramViewGroup, ListView paramListView, XpListenersCenter.AdapterListener paramAdapterListener)
/*     */   {
/* 504 */     if (a(8)) {
/* 505 */       return;
/*     */     }
/* 507 */     this.j.layoutType = 8;
/* 508 */     new EmbededContainer(this.c, paramViewGroup, paramListView, this.j, 
/* 509 */       paramAdapterListener, null, this.i);
/*     */   }
/*     */ 
/*     */   public void addView(ViewGroup paramViewGroup, ListView paramListView)
/*     */   {
/* 520 */     addView(paramViewGroup, paramListView, null);
/*     */   }
/*     */ 
/*     */   public void setBannerOnClickListener(View.OnClickListener paramOnClickListener) {
/* 524 */     if (this.a != null)
/* 525 */       this.a.a(paramOnClickListener);
/* 526 */     else if (this.b != null) this.b.a(paramOnClickListener); 
/*     */   }
/*     */ 
/*     */   public void setReportListener(XpListenersCenter.ReportListener paramReportListener)
/*     */   {
/* 530 */     XpReportClient.registerReportListener(paramReportListener);
/*     */   }
/*     */ 
/*     */   public void setFloatDialogConfig(FloatDialogConfig paramFloatDialogConfig) {
/* 534 */     this.h = paramFloatDialogConfig;
/*     */   }
/*     */ 
/*     */   public void setLargeGalleryConfig(LargeGalleryConfig paramLargeGalleryConfig) {
/* 538 */     this.g = paramLargeGalleryConfig;
/*     */   }
/*     */ 
/*     */   public void setGridTemplateConfig(GridTemplateConfig paramGridTemplateConfig) {
/* 542 */     this.i = paramGridTemplateConfig;
/*     */   }
/*     */ 
/*     */   public ExchangeViewManager setEntryOnClickListener(XpListenersCenter.EntryOnClickListener paramEntryOnClickListener)
/*     */   {
/* 552 */     if ((this.e != null) && (this.e != paramEntryOnClickListener)) {
/* 553 */       Log.e(this.f, "EntryOnClickListener is exist, and make old listener invalid...");
/* 554 */       this.e = paramEntryOnClickListener;
/* 555 */     } else if (this.e == null) {
/* 556 */       Log.a(this.f, "EntryOnClickListener set up...");
/* 557 */       this.e = paramEntryOnClickListener;
/*     */     }
/*     */ 
/* 560 */     return this;
/*     */   }
/*     */ 
/*     */   public void onOrientationChanaged(int paramInt) {
/* 564 */     switch (this.j.layoutType) {
/*     */     case 15:
/* 566 */       W.a(paramInt);
/* 567 */       break;
/*     */     }
/*     */   }
/*     */ 
/*     */   private void a(Promoter paramPromoter, XpListenersCenter.FloatDialogListener paramFloatDialogListener)
/*     */   {
/* 575 */     AlertDialog.Builder localBuilder = new AlertDialog.Builder(this.c);
/* 576 */     localBuilder.setMessage(paramPromoter.title);
/* 577 */     localBuilder.setPositiveButton("确认", new O(this, paramPromoter, paramFloatDialogListener));
/*     */ 
/* 599 */     localBuilder.setNegativeButton("取消", new F(this));
/*     */     try
/*     */     {
/* 608 */       localBuilder.create().show();
/*     */ 
/* 610 */       com.umeng.newxp.net.e locale = new e.a(this.c)
/* 611 */         .a(0).b(0).d(0)
/* 612 */         .d(this.j.getTimeConsuming())
/* 613 */         .c(this.d).a(new Promoter[] { paramPromoter })
/* 614 */         .b(g.a(this.c, this.j)).a(this.j.slot_id)
/* 615 */         .c(this.j.sessionId).a();
/* 616 */       new XpReportClient(this.c).sendAsync(locale, null);
/*     */     }
/*     */     catch (WindowManager.BadTokenException localBadTokenException) {
/* 619 */       Log.e(this.f, "Can`t show dialog ", localBadTokenException);
/*     */     }
/*     */   }
/*     */ }

/* Location:           C:\Users\Administrator\Desktop\umeng_sdk.jar
 * Qualified Name:     com.umeng.newxp.view.ExchangeViewManager
 * JD-Core Version:    0.6.2
 */